package a12;

import static org.junit.Assert.*;

import java.io.FileNotFoundException;
import java.io.FileReader;

import javax.swing.JOptionPane;

import junit.framework.TestCase;

import org.junit.Test;

public class IndexTester extends TestCase{

	@Test
	public void test() {
		 
		try {
			FileReader fileReader = new FileReader("10kwords.txt");
			WordIndex idx = new WordIndex(fileReader);
			String finalWord=" ";
			
			String startingWord="red";
			String scrambledWord = "der";
			String result = a12.WordIndex.lookup(scrambledWord);
			boolean b = result.contains(startingWord);
			assertTrue(b);
			
			String startingWord2="funny";
			String scrambledWord2 = "fnyun";
			String result2 = a12.WordIndex.lookup(scrambledWord2);
			boolean b2 = result2.contains(startingWord2);
			assertTrue (b2);
			
			String startingWord3="nanaab";
			String scrambledWord3 = "anbana";
			String result3 = a12.WordIndex.lookup(scrambledWord3);
			boolean b3 = result3.contains(startingWord3);
			System.out.println(b3);
			assertFalse ( b3);
//			the startingWord is not an actual word, and should be false
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
			
	}

}
